/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.regex.Pattern;

/**
 * <p>Project: javase - Reg9
 * <p>Powered by webrx On 2021-12-07 15:31:14
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Reg9 {
    public static void main(String[] args) {
        //显示div标签有java的标签直接显示
        String h = "java<div>hello-Java</div><br><div>htm</div><span>java</span><div>java</div>java<div>hellojavascriptok</div>";
        var p = Pattern.compile("<div>[\\-a-z\\s]*java[\\-a-z\\s]*</div>", Pattern.CASE_INSENSITIVE);
        var m = p.matcher(h);
        while (m.find()) {
            System.out.println(m.group());
        }

        System.out.println(h);
        //div标签中包括java字符串，全部替换为javb字符串
        String t = h.replaceAll("(<div>[\\-a-z\\s]*?)(Jav|jav)(a)([\\-a-z\\s]*?</div>)", "$1$2b$4");
        System.out.println(t);


    }
}
